package com.example.tpintegrador;

import com.artfulbits.aiCharts.ChartView;
import com.artfulbits.aiCharts.Base.ChartPoint;
import com.artfulbits.aiCharts.Base.ChartSeries;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class RegistroLlamadas extends Activity implements OnClickListener {
	
	private String nombreContacto;
	private String fotoContacto;
	private String idContacto;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.registro_llamadas);
		Button detalle= (Button) findViewById(R.id.button1);
		detalle.setOnClickListener(this);
		
		TextView n = (TextView) this.findViewById(R.id.txtContacto);
		ImageView photo = (ImageView) this.findViewById(R.id.fotoContacto);
		
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			idContacto= extras.getString("idContacto");
			nombreContacto=extras.getString("nombreContacto");
			n.setText(nombreContacto);
			fotoContacto=extras.getString("fotoContacto");
			photo.setImageURI(Uri.parse(fotoContacto));
			
		}
				
		ChartView chartView = (ChartView) findViewById(R.id.chartView);

        ChartSeries series = chartView.getSeries().get(0);

        double[] data = { 50, 10, 5 };
        String[] labels = { "Llamadas Realizadas", "Llamadas Recibidas", "Llamadas Perdidas" };
		
        for (int i = 0; i < data.length; i++)
        {
            ChartPoint point = series.getPoints().addXY(i, data[i]);
			
            point.setLabel(labels[i]);
        }
        
		}
	
	@Override
	public void onClick(View view) {
		Intent i = new Intent(this, RegistroLlamadaDetalle.class);
		Bundle bundle = new Bundle();
		bundle.putString("idContacto", idContacto);
		bundle.putString("nombre", nombreContacto);
		bundle.putString("foto", fotoContacto);
		i.putExtras(bundle);
 		startActivity(i);	
	}
}
